package cn.iocoder.yudao.module.picturebook.dal.mysql.bookshelf;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.picturebook.dal.dataobject.bookshelf.BookShelfDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.picturebook.controller.admin.bookshelf.vo.*;

/**
 * 用户书架关联 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BookShelfMapper extends BaseMapperX<BookShelfDO> {

    default PageResult<BookShelfDO> selectPage(BookShelfPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BookShelfDO>()
                .eqIfPresent(BookShelfDO::getUserId, reqVO.getUserId())
                .eqIfPresent(BookShelfDO::getBookId, reqVO.getBookId())
                .eqIfPresent(BookShelfDO::getShelfType, reqVO.getShelfType())
                .betweenIfPresent(BookShelfDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BookShelfDO::getId));
    }

}